package com.tvunetworks.center.device.config.mybatis;

import org.springframework.context.annotation.Bean;
import tk.mybatis.spring.mapper.MapperScannerConfigurer;

/**
    * @ClassName: MyBatisMapperScannerConfig  
    * @Description: Mybatis BasePackage配置
    * @author lebron  

    *    
    */  
//@Configuration
//注意，由于MapperScannerConfigurer执行的比较早，所以必须有下面的注解
//@AutoConfigureAfter(MybatisConfiguration.class)
public class MyBatisMapperScannerConfig {
    /**
     *
     * @return MapperScannerConfigurer
     */
  @Bean
  public MapperScannerConfigurer mapperScannerConfigurer() {
      MapperScannerConfigurer mapperScannerConfigurer = new MapperScannerConfigurer();
      mapperScannerConfigurer.setSqlSessionFactoryBeanName("sqlSessionFactory");
      //由于MapperScannerConfigurer在配置文件值注入之前注入，所以这里必须硬编码
      mapperScannerConfigurer.setBasePackage("com.tvunetworks.center.device.mapper");
      return mapperScannerConfigurer;
  }

}
